package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.DiseaseTargetMapper;
import com.ruoyi.web.domain.DiseaseTarget;
import com.ruoyi.web.service.IDiseaseTargetService;
import com.ruoyi.common.core.text.Convert;

/**
 * 疾病靶点Service业务层处理
 * 
 * @author drx
 * @date 2025-05-12
 */
@Service
public class DiseaseTargetServiceImpl implements IDiseaseTargetService 
{
    @Autowired
    private DiseaseTargetMapper diseaseTargetMapper;

    /**
     * 查询疾病靶点
     * 
     * @param id 疾病靶点主键
     * @return 疾病靶点
     */
    @Override
    public DiseaseTarget selectDiseaseTargetById(Long id)
    {
        return diseaseTargetMapper.selectDiseaseTargetById(id);
    }

    /**
     * 查询疾病靶点列表
     * 
     * @param diseaseTarget 疾病靶点
     * @return 疾病靶点
     */
    @Override
    public List<DiseaseTarget> selectDiseaseTargetList(DiseaseTarget diseaseTarget)
    {
        return diseaseTargetMapper.selectDiseaseTargetList(diseaseTarget);
    }

    /**
     * 新增疾病靶点
     * 
     * @param diseaseTarget 疾病靶点
     * @return 结果
     */
    @Override
    public int insertDiseaseTarget(DiseaseTarget diseaseTarget)
    {
        diseaseTarget.setCreateTime(DateUtils.getNowDate());
        diseaseTarget.setCreateBy(ShiroUtils.getSysUser().getLoginName());
        diseaseTarget.setCreateName(ShiroUtils.getSysUser().getUserName());
        return diseaseTargetMapper.insertDiseaseTarget(diseaseTarget);
    }

    /**
     * 修改疾病靶点
     * 
     * @param diseaseTarget 疾病靶点
     * @return 结果
     */
    @Override
    public int updateDiseaseTarget(DiseaseTarget diseaseTarget)
    {
        diseaseTarget.setUpdateTime(DateUtils.getNowDate());
        diseaseTarget.setUpdateBy(ShiroUtils.getSysUser().getLoginName());
        diseaseTarget.setCreateName(ShiroUtils.getSysUser().getUserName());
        return diseaseTargetMapper.updateDiseaseTarget(diseaseTarget);
    }

    /**
     * 批量删除疾病靶点
     * 
     * @param ids 需要删除的疾病靶点主键
     * @return 结果
     */
    @Override
    public int deleteDiseaseTargetByIds(String ids)
    {
        return diseaseTargetMapper.deleteDiseaseTargetByIds(Convert.toStrArray(ids),ShiroUtils.getSysUser().getLoginName());
    }

    /**
     * 删除疾病靶点信息
     * 
     * @param id 疾病靶点主键
     * @return 结果
     */
    @Override
    public int deleteDiseaseTargetById(Long id)
    {
        return diseaseTargetMapper.deleteDiseaseTargetById(id,ShiroUtils.getSysUser().getLoginName());
    }
}
